<?php

namespace App\HttpController\XAppSystem\ZCommon\Admin;


use App\HttpController\ControllerAdmin;
use App\Model\t_wx_reply;
use XWX\Common\H;

class Comp extends ControllerAdmin
{
    public function compReply()
    {
        $compKw = $this->reqParam("compKw");
        if (H::funcStrIsNullOrEmpty($compKw))
        {
            return $this->funcWriteErr(-1000, "缺少参数");
        }


        $query = $this->db()
            ->where("reply_x_id", $this->funcGetX())
            ->where("reply_app_id", "reply");

        $query
            ->where("reply_name", "%{$compKw}%", "LIKE");

        $list = $query->get(t_wx_reply::table(), 10, "reply_id,reply_name,reply_key,reply_type");

        $list_ = [];
        foreach ($list as $item)
        {
            $list_[$item['reply_id']] = $item;
        }
        $this->commonR()->setData("list", $list_);

        $this->funcWriteCommonR();
    }
}